var mallIndexUtil={
		searchIconInit:false,
		searchParam:{
			resource_Name:$("#mainSearchPM").val(),
			resource_Spec:$("#mainSearchGG").val(),//规格
			resource_Area:$("#mainSearchGC").val(),//产地
			resource_stuff:$("#mainSearchPH").val(),//牌号
			resource_storage:$("#mainSearchCK").val(),//仓库z
			searchCodeIndex:$("#searchCodeTemp").val(),//?
			recordnum:70
		},
		//加载品名数据
		initSteNameRecommend:function(){
			 //根据大类显示品名
			var pm = '';//$("#steNameCodeList").find(".on").phHandler('全部');
			var pmVal = $("#searchInputPM").phHandler('输入品名');

			var data = {
				   "resource.resource_Name":pmVal,
				   "resource.orderByCol":"1",
				   "resource.steNameCode":pm,				
				   "resource.resource_Spec": this.searchParam.resource_Spec,
				   "resource.resource_Area":this.searchParam.resource_Area,
				   "resource.resource_stuff":this.searchParam.resource_stuff,
				   "resource.resource_storage":this.searchParam.resource_storage,
				   "resource.searchCodeIndex":this.searchParam.searchCodeIndex,
				   "resource.recordnum":this.searchParam.recordnum
			};
			// 若是店铺搜索，直接在条件中增加供应商名称
            var mallCorpName = $("#mallCorpName").val();
		    if(mallCorpName){
		        data["resource.supName"]=mallCorpName;
            }
			var htmlStr = "";
			$.post(app.root+"/mall/getResourceRecomendList201707.html?rm="+Math.random(),data, function(datas) {
			 
				$("#v_pmlist").children("a").remove();
				htmlStr = "";
				var tmp="<a class='mallSearchList dib condition' href='javascript:void(0)' searchtype='pm_zy' onclick='mallIndexUtil.setNavSearch(this)' title='{0}'>{0}</a>";
				
				$.each(datas,function(i,item){					 
					htmlStr += tmp.format(item);				 
				});
				if(datas.length<11){
					$("#v_pmDiv").find(".shop_px").hide();
				}else{
					$("#v_pmDiv").find(".shop_px").show();
				}
				$("#v_pmlist").html(htmlStr);
				$("#v_pmlist").show();
			 
			});
		},
		//加载规格数据
		initSteSpecRecommend:function(){
			var ggVal = $("#searchInputGG").phHandler('输入规格');
			
			var data = {
			   //规格
			   "resource.orderByCol":"2",
			   //已选的条件
			   "resource.resource_Name":this.searchParam.resource_Name,
			   "resource.resource_Spec":ggVal,
			   "resource.resource_Area":this.searchParam.resource_Area,
			   "resource.resource_stuff":this.searchParam.resource_stuff,
			   "resource.resource_storage":this.searchParam.resource_storage,
			   "resource.searchCodeIndex":this.searchParam.searchCodeIndex,
			   "resource.recordnum":this.searchParam.recordnum
		    };
			// 若是店铺搜索，直接在条件中增加供应商名称
            var mallCorpName = $("#mallCorpName").val();
		    if(mallCorpName){
		        data["resource.supName"]=mallCorpName;
            }
							 
		    var htmlStr = "";
		  	$.post(app.root+"/mall/getResourceRecomendList201707.html?rm="+Math.random(),data, function(datas) {
			 
				$("#v_gglist").children("a").remove();
				htmlStr = "";
				var tmp="<a class='mallSearchList dib condition' href='javascript:;' searchtype='gg_zy' onclick='mallIndexUtil.setNavSearch(this)'  title='{0}'>{0}</a>";
				$.each(datas,function(i,item){
					if(i<31){
						htmlStr += tmp.format(item);
					}
				});
				$("#v_gglist").html(htmlStr);
				$("#v_gglist").show();
				if(datas.length<7){
					$("#v_ggDiv").find(".shop_px").hide();
				}else{
					$("#v_ggDiv").find(".shop_px").show();
				}
				
			});
		},
		//加载牌号数据
		initSteStuffRecommend:function(){
			var phVal = $("#searchInputPH").phHandler('输入牌号');
			var data = {
			   //牌号
			   "resource.orderByCol":"4",
			   //已选的条件
			   "resource.resource_Name":this.searchParam.resource_Name,
			   "resource.resource_Spec":this.searchParam.resource_Spec,
			   "resource.resource_Area":this.searchParam.resource_Area,
			   "resource.resource_stuff":phVal,
			   "resource.resource_storage":this.searchParam.resource_storage,
			   "resource.searchCodeIndex":this.searchParam.searchCodeIndex,
			   "resource.recordnum":this.searchParam.recordnum
		    };
			// 若是店铺搜索，直接在条件中增加供应商名称
            var mallCorpName = $("#mallCorpName").val();
		    if(mallCorpName){
		        data["resource.supName"]=mallCorpName;
            }
					
			var htmlStr = "";
			var tmp="<a class='mallSearchList dib condition' href='javascript:;' searchtype='cz_zy' onclick='mallIndexUtil.setNavSearch(this)' title='{0}'>{0}</a>";
		    var num=0;
		  	$.post(app.root+"/mall/getResourceRecomendList201707.html?rm=" + Math.random(), data, function(datas) {
				
				 
				$("#v_phlist").children("a").remove();
				htmlStr = "";
				$.each(datas,function(i,item){
					if(i<31){
						htmlStr += tmp.format(item);
					}
				});
				
			  	$("#v_phlist").html(htmlStr);
			  	$("#v_phlist").show();
				if(datas.length<7){
					$("#v_phDiv").find(".shop_px").hide();
				}else{
					$("#v_phDiv").find(".shop_px").show();
				}
			});
		},
		//初始化钢厂
		initSteAreaRecommend:function(){
			var gcVal = $("#searchInputGC").phHandler('输入钢厂');
			var data = {
			   //规格
			   "resource.orderByCol":"3",
			   //已选的条件
			   "resource.resource_Name":this.searchParam.resource_Name,
			   "resource.resource_Spec":this.searchParam.resource_Spec,
			   "resource.resource_Area":gcVal,
			   "resource.resource_stuff":this.searchParam.resource_stuff,
			   "resource.resource_storage":this.searchParam.resource_storage,
			   "resource.searchCodeIndex":this.searchParam.searchCodeIndex,
			   "resource.recordnum":this.searchParam.recordnum
		    };
			// 若是店铺搜索，直接在条件中增加供应商名称
            var mallCorpName = $("#mallCorpName").val();
		    if(mallCorpName){
		        data["resource.supName"]=mallCorpName;
            }
							 
		    var htmlStr = "";
		    var tmp="<a class='mallSearchList dib' href='javascript:;' searchtype='gc_zy' onclick='mallIndexUtil.setNavSearch(this)'  title='{0}'>{0}</a>";
		  	$.post(app.root+"/mall/getResourceRecomendList201707.html?rm="+Math.random(),data, function(datas) {
				$("#v_gclist").children("a").remove();
				htmlStr = "";
				$.each(datas,function(i,item){
					if(i<31){
						htmlStr += tmp.format(item);
					}
				});
				$("#v_gclist").html(htmlStr);
				$("#v_gclist").show();
				if(datas.length<13){
					$("#v_gcDiv").find(".shop_px").hide();
				}else{
					$("#v_gcDiv").find(".shop_px").show();
				}
			});
		},
		initSteStorageRecommend:function (){
			var ckVal = $("#searchInputCK").phHandler("输入仓库");
			var data = {
			   //仓库
			   "resource.orderByCol":"5",
			   //已选的条件
			   "resource.resource_Name":this.searchParam.resource_Name,
			   "resource.resource_Spec":this.searchParam.resource_Spec,
			   "resource.resource_Area":this.searchParam.resource_Area,
			   "resource.resource_stuff":this.searchParam.resource_stuff,
			   "resource.searchCodeIndex":this.searchParam.searchCodeIndex,
			   "resource.resource_storage":ckVal,
			   "resource.recordnum":this.searchParam.recordnum,
		    };
					
			var htmlStr = "";
			var tmp= "<a class='sContentList ell poi' href='javascript:void(0)' onclick='setDepotValue(this)' title='{0}'>{0}</li>";
			
		  	$.post(app.root+"/mall/getResourceRecomendList201707.html?rm=" + Math.random(), data, function(datas) {
				$("#v_cklist").html("");
				htmlStr = "";
				$.each(datas,function(i,item){
					if(i<31){
						htmlStr +=tmp.format(item);
					}
				});
				$("#v_cklist").html(htmlStr);
			});
		},
		
		setNav:function(obj){
			var $obj = $(obj);
			var searchtype = $obj.attr('searchtype');
			var text=$obj.text();
			//如果搜索类型不为空，则对应类型隐藏域赋值
			if(searchtype){
				$("#"+searchtype).val(text)
			}
			
			if($obj.parent(".mallScontent").find(".active").length>0){
				var activeobj=$obj.parent(".mallScontent").find(".active");
				activeobj.attr("title",text);
				activeobj.find(".mallSListTxt").text(text);
			}else{
				var str='<a class="mallSearchList dib active" href="javascript:;" searchtype="'+searchtype+'" title="'+text+'">'
						+'<span class="mallSListTxt">'+text+'</span><i class="dib h_icon mallSListCancel vm ml5"></i></a>';
				$obj.parent(".mallScontent").prepend(str);
			}
		},
		setNavSearch:function(obj){
			this.setNav(obj);
			this.sousuo_zy(0);
		},
		sousuo_zy:function(refreshType){//refreshtype :是否用于分页查询 1是0否
			var type=$("#type_zy").val();
			var pm=$("#pm_zy").phHandler('品名');
			var gc=$("#gc_zy").phHandler('钢厂');
			var gg=$("#gg_zy").phHandler('规格');
			var cz=$("#cz_zy").phHandler('牌号');
			var qy=$("#qy_zy").phHandler('区域');
			var ysc=$("#ysc_zy").phHandler('云商城');
			var ck=$("#ck_zy").phHandler('仓库');
			var minWeight=$("#minWeight").phHandler('重量');
			var maxWeight=$("#maxWeight").phHandler('重量');
			if(minWeight*1 != minWeight){
				minWeight='';
				$("#minWeight").val('');
			}
			if(maxWeight*1 != maxWeight){
				maxWeight='';
				$("#maxWeight").val('');
			}
			var supPickDateStart = $("#supPickDateStart").phHandler('提货日期');
			var supPickDateEnd = $("#supPickDateEnd").phHandler('提货日期');
			var searchCode = $("#searchCodeTemp").val();
			var steSort = $("#steSortDiv").find(".selected").phHandler('全部');
			
			var searchCodeIndex = $("#HeaderSearch").phHandler('品名  |  牌号  |  规格  |  钢厂  |  仓库（支持首字母查询）');
			//$("#HeaderSearch").val("");
		    var datas = {
			   //品名
			   "resource.stename":encodeURI(pm),
			   //钢厂
			   "resource.stearea":encodeURI(gc),
			   //规格
			   "resource.resource_Spec":encodeURI(gg),
			   //牌号
			   "resource.resource_stuff":cz,
			   //区域
			   "resource.resource_Address":encodeURI(qy),
			   //仓库
			   "resource.resource_storage":encodeURI(ck),
			   //一键、议价购买
			   "resource.type":type,
			   //最低价
			   "resource.minWeight":minWeight,
			   //最高价
			   "resource.maxWeight":maxWeight, 
			   "resource.searchCodeIndex":searchCodeIndex,
	   		   "resource.supPickDateEnd":supPickDateEnd,
	   		   "resource.supPickDateStart":supPickDateStart,
			   //搜索栏	   
			   "resource.searchCode":searchCode,
			   //云商城
			   "resource.saasUserName":ysc
			   //url标记
	   		   //"urlMark":$("#lgsc_urlMark").val()
		    };
		    //判断是否有查询条件
		    var hasCondi='0';
		    for(var k in datas){
		    	if(datas[k]){
		    		hasCondi='1';
		    		break;
		    	}
		    }
		    datas["hasCondi"]=hasCondi;
		    
		    if(refreshType==1){
		    	datas["pager.pageSize"] = $("#pageSizes").val();
		    	datas["pager.pageNum"] = $("#pageNums").val();
		    	datas["pager.resultCount"] = $("#resultCounts").val();
		    	datas["resource.orderByCol"] = $("#orderByCol").val();
		    	datas["resource.orderByType"] = $("#orderByType").val();
		    	// 无查询条件，只对价格升序降序排列时，也需要去数据库重新查
		    	datas["hasCondi"]='1';
		    }

		    // 若是店铺搜索，直接在条件中增加供应商名称
            var mallCorpName = $("#mallCorpName").val();
		    if(mallCorpName){
		        datas["mallCorpName"]=mallCorpName;
            }


		    var url = app.root+"/mall/findCustOrderResourceGold201707";
		   /* if(this.searchIconInit){//初始化时不修改
			    //$("#searchIcon").removeClass('searchN');
			    //$("#searchIcon").removeClass('searchOut');
			    //$("#searchIcon").addClass('searching');
		    }*/
		    $("#loading").show();
		    $.ajax({
				   type: "POST",
				   url: url,
				   data:datas,
				   dataType:"html",
				   success: function(data){
					   $("#pageListDiv").html(data);
					   $("#loading").height(80);
					   $("#loading").hide();	
					   $("#pageListDiv").show();
					   mallIndexUtil.markBoughtRes();
					   //if(mallIndexUtil.searchIconInit){//初始化时不修改
					//	    $("#searchIcon").removeClass('searching');
					//	    $("#searchIcon").removeClass('searchN');
					//	    $("#searchIcon").addClass('searchOut');
					//   }
					  // $("#searchCondition~.sResNum>strong").text($("#resultCounts").val());
					   //mallIndexUtil.searchIconInit = true;
				   } 
			});
		    if(!$("#HeaderSearch").val()){
		    	$("#HeaderSearch").val('品名  |  牌号  |  规格  |  钢厂  |  仓库（支持首字母查询）');
		    }
		},
		/**
		 * 标记 已购买的资源 
		 */
		markBoughtRes:function(){
			$.post(app.root+"/shopping/cart/queryCartSimple",{},function(map){
				if(map['succ'] == '1'){
					var list = map['carts'];
					for(var i in list){
						$("[resid='"+list[i].resourceID+"']").addClass("active");
					}
				}
			},'json');
		},
		showMsearch:function (obj){
			var keyword = $.trim($("#HeaderSearch").val());
			keyword=keyword.replace(/'/g,"");
			if(keyword == '品名  |  牌号  |  规格  |  钢厂  |  仓库（支持首字母查询）'){
				keyword='';
				$("#HeaderSearch").val('');
			}
			var myobj = $(obj).next('div.sContent');
			//ajax请求查询出搜索推荐关键词
			$.ajax({
	 		   type: "POST",
	 		   url: app.root+'/mall/getSearchWordList.html',	 
	 		   data:{"searchWord":keyword},
	 		   dataType: "json",
	 		   success: function(data){
	 				    var list = data.list;
	 				    var tmp="<a py='{1}' pyjc='{2}' class='sContentList ell poi j_sitem' onClick='mallIndexUtil.gotoSearch(this,event)'>{0}</a>";

	 				    if(list === undefined){
				 			myobj.hide();
					    }else{
					    	var str = "";
				 			for(var i=0; i<list.length; i++){
				      	      if(list[i].RESOURCE_NAME){
				      	    	  str += tmp.format(list[i].RESOURCE_NAME,pinyinHandler.getFullChars(list[i].RESOURCE_NAME) ,pinyinHandler.getCamelChars(list[i].RESOURCE_NAME))
				      	      }
					      	} 
				 			myobj.find(".mCSB_container").html(str);
				 			myobj.css({"width":myobj.parents(".bannerSearch ").width(),"top":myobj.parents(".bannerSearch ").height()});
				 			myobj.show();
					    }
	 		   } 
	 		});
			
		},
		isEnterKey:function (obj,e){
			  if(e.keyCode == "13"){
				  this.doSearch();
			  }
		 },
		doResourceSearch: function (searchCriteria){
			 
			if(searchCriteria == '品名  |  牌号  |  规格  |  钢厂  |  仓库（支持首字母查询）'){
				 searchCriteria='';
			}
			 
			$("#HeaderSearch").val(searchCriteria);
			var splitStr = " ";
			if(searchCriteria.indexOf("/")>-1){
				splitStr="/"
			}
			var searchCodeArr = searchCriteria.split(splitStr);
			var tempEle;
			$("#searchCodeTemp").val("");// 先清空，再往里面放
			for(var i=0;i<searchCodeArr.length;i++){
				if(searchCodeArr[i]){
					tempEle = $("#mallsearch").find(".condition[title='"+searchCodeArr[i]+"']");
					if(tempEle.length>0){
						this.setNav(tempEle[0]);
					}else{
						$("#searchCodeTemp").val($("#searchCodeTemp").val()+" "+searchCodeArr[i]);
					}
				}
			}
			this.initSearchCodeChange();
		  },
		initSearchCodeChange:function (){
 	  		$("#resourceCategoryID").val("");
 	  		$("#resource_Name").val("");
 	  		$("#resource_Area").val("");
 	 		/*$("#minMoneyTemp").val("最低价");
 	 		$("#maxMoneyTemp").val("最高价");
 	 		$("#minMoneyTemp").blur();
 	 		$("#maxMoneyTemp").blur();*/
 	 		this.sousuo_zy(0);
		},
		gotoSearch:function (obj){
			var searchCriteria=$(obj).text();
			//隐藏搜索框下拉菜单
			$(obj).closest('.sContent').hide();
			$(obj).closest(".bannerSearch").addClass("active");
			this.doResourceSearch(searchCriteria);
		},
		doSearch:function(){
			var str = $("#HeaderSearch").val();
			this.doResourceSearch(str);
		},
		//加载 区域 下拉信息
		loadAddrList:function (){
			var tmp='<a py="{1}" pyjc="{2}" class="sContentList ell poi j_sitem">{0}</a>'
			$.post(app.root+"/mall/loadResourceAddress",{},function(list){
				if(!list||list.length==0){
				}else{
					var html='';
					for (var i=0;i<list.length;i++){
						html += tmp.format(list[i], pinyinHandler.getFullChars(list[i]) ,pinyinHandler.getCamelChars(list[i])) // '<a class="sContentList ell poi">'+list[i]+'</a>';
					}
					if($("#addr_ul .mCSB_container").length == 0){ // 插件尚未初始化
						$("#addr_ul").html(html);
					}else{
						$("#addr_ul .mCSB_container").html(html);
					}
				}
			},'json');
		},
		//加载 仓库 下拉数据
		loadDepotList:function (obj){
			var depotText = !obj.value?'':obj.value;
			var tmp='<a py="{1}" pyjc="{2}" class="sContentList ell poi j_sitem">{0}</a>'
			$.post(app.root+"/mall/loadResourceDepot?rm="+Math.random(),{'depotText':depotText},function(list){
				if(!list||list.length==0){
				}else{
					var html='';
					for (var i=0;i<list.length;i++){
						html += tmp.format(list[i], pinyinHandler.getFullChars(list[i]) ,pinyinHandler.getCamelChars(list[i]));
					}
					$("#depot_ul .mCSB_container").html(html);
				}
			},'json');
		},
		//加载 钢厂 下拉数据
		loadAreaList:function (obj){
			var areaText = !obj.value?'':obj.value;
			var tmp='<a py="{1}" pyjc="{2}" class="sContentList ell poi j_sitem">{0}</a>';
			$.post(app.root+"/mall/loadResourceArea?rm="+Math.random(),{'areaText':areaText},function(list){
				if(!list||list.length==0){
				}else{
					var html='';
					for (var i=0;i<list.length;i++){
						html += tmp.format(list[i], pinyinHandler.getFullChars(list[i]) ,pinyinHandler.getCamelChars(list[i]));
					}
					$("#area_ul .mCSB_container").html(html);
					
				}
			},'json');
		},
		//加载 云商城 下拉数据
		loadYscList:function (){
			var tmp='<a py="{1}" pyjc="{2}" class="sContentList ell poi j_sitem">{0}</a>';
			$.post(app.root+"/mall/loadSaasResourceUsers",{},function(list){
				if(!list||list.length==0){
				}else{
					var html='';
					for (var i=0;i<list.length;i++){
						html += tmp.format(list[i], pinyinHandler.getFullChars(list[i]) ,pinyinHandler.getCamelChars(list[i]));
					}
					
					if($("#ysc_ul .mCSB_container").length == 0){ // 插件尚未初始化
						$("#ysc_ul").html(html);
					}else{
						$("#ysc_ul .mCSB_container").html(html);
					}
					
				}
			},'json');
		},
		setListValue:function(obj,type){//仓库、区域、钢厂 点选
			var val =$(obj).text();
			if(type == 1 ){//区域
				$("#qy_zy").val(val);
			}else if(type == 2){//仓库
				$("#ck_zy").val(val);
			}else if(type == 3){//区域
				$("#gc_zy").val(val);
			}else if(type == 4){//云商城
				$("#ysc_zy").val(val);
			}
		}, 
		openList : function(btnObj){ //点击 [展开]时,加载 列表
	    	
			var obj = $(btnObj).closest('div.tableList');
			$(obj).attr("saasUserID",$(btnObj).attr("saasUserID"));
	    	this.loadResourceGroupList(obj);

	    },
	    loadResourceGroupListForScroll : function (obj,pageObj,callback){
	    	var datas = this.preLoadResourceGroupList(obj,pageObj);
	     	
	     	$.post(app.root+"/mall/loadResourceGroupList",datas,function(data){
	    		var html = '';
	    		if(data.list.length > 0 ){
	    			var list  = data.list;
	    			for(var i in list){
	    				var resource_stuff = (list[i].resource_stuff=='不限'|| list[i].resource_stuff=='') ? 'Ybcz':list[i].resource_stuff;
	    				var class1 = (list[i].isProcImage!=null && list[i].isProcImage==0 )? 'neg':'green' ;
	    				var tmp1 = (list[i].isProcImage!=null && list[i].isProcImage==0 )? '一键购买':'议价购买' ;
	    				var tmp2 = (list[i].isProcImage!=null && list[i].isProcImage==0 )? '一键购买：价格不可议，销售合同一键生成':'议价购买：价格可议，销售合同需核价生成' ;
	     				html +='<div class="subTableList">'
				    			+	'<div class="l pct20 indent20 ell">'
				    			+	'	<label class="dib iconcheckbox poi vm mr5 rel">'
				    			+	'		<input type="checkbox" class="opacity-checkbox abs poi chooseOne" onclick="chooseOne(this)"'
				    			+	'		 	weight="'+list[i].resource_Weight +'" price="'+list[i].resource_Price+'" rid="'+list[i].id +'"/>'
				    			+	'	</label>'
				    			+		resource_stuff
				    			+	'</div>'
				    			+	'<div class="l pct15 ell">'+list[i].resource_Spec +'</div>'
				    			+	'<div class="l pct20 tc ell">'+list[i].resource_Quantity +'</div>'
				    			+	'<div class="l pct15 tc ell">'+list[i].resource_Weight +'</div>'    
				    			+	'<div class="l pct20 tc red">¥'+list[i].resource_Price+'</div>'
				    			+	'<div class="l pct10 tc smallsetHover rel">'
				    			+	'	<a saasUserID="'+list[i].saasUserID +'" isHaveInCart="'+list[i].isHaveInCart +'" lockPlanWeight="'+list[i].lockPlanWeight+'"'
				    			+	'	 isLockPlan="'+list[i].isLockPlan+'" onclick="mallIndexUtil.addCart(this,\''+list[i].id +'\',\''+list[i].isProcImage +'\');" href="javascript:;"'
				    			+	'	 supID="'+list[i].supID+'" class="'+class1 
				    			+	'"	 >'+tmp1+'</a>'
				    			+	'<span class="hover_ck tl">'
				    			+	'	<i class="dib abs hover_ckdot" style=\'right:20px\'><i class="dib abs hover_ckdot2"></i></i>'
				    			+	'	<span class="f12 dib"><span class="f12 dib">'+tmp2+'</span></span>'
				    			+	'</span>'
				    			+	'</div>'
				    			+'</div>';
	    				
	    			}
	    		}
	    		$(obj).next('.subTable').find('.subTableCont .mCSB_container .loadTip').before(html);
	    		$(obj).next('.subTable').find("#s_pageNum").val(pageObj['pager.pageNum']);
	    		
	    		callback && callback();
	    		
	    		var totalPage = $(obj).next('.subTable').find("#s_totalPage").val();
    			var	pageNum = Number(pageObj['pager.pageNum'])+1;
    			
    			if(pageNum < 1||pageNum > totalPage){
    				$(obj).next('.subTable').find(".loadTip .loading").hide();
    				$(obj).next('.subTable').find(".loadTip .loaded").show();
    			}
    			
	    	},'json');   
	    },
	    loadResourceGroupList : function (obj,pageObj){
	    	
	    	var datas = this.preLoadResourceGroupList(obj,pageObj);
	    	
	    	$(obj).next('.subTable').load(app.root+"/mall/openResourceList",datas,function(response,status,xhr){
	    		if(status =="success"){
	    			$(obj).next('.subTable').find(".subTableCont").mCustomScrollbar({
					    theme:"minimal-dark",
					    callbacks:{
					    	onTotalScrollOffset:150,
					    	onTotalScroll: function(){
					    		mergedPrdListMng._loadDataForScroll($(obj).next('.subTable'));
					    	}
			    			
			    			
						}
					});	
	    			$(obj).next('.subTable').show();
	    			
	    			var totalPage = $(obj).next('.subTable').find("#s_totalPage").val();
	    			var pageNum = $(obj).next('.subTable').find("#s_pageNum").val();
	    				pageNum = Number(pageNum)+1;
	    			
	    			if(pageNum < 1||pageNum > totalPage){
	    				$(obj).next('.subTable').find(".loadTip .loading").hide();
	    				$(obj).next('.subTable').find(".loadTip .loaded").show();
	    			}
	    			
	    		}
	    	});   
	    },
	    preLoadResourceGroupList:function (obj,pageObj){
	    	var minWeight=$("#minWeight").phHandler('重量');
			var maxWeight=$("#maxWeight").phHandler('重量');
	    	if(minWeight*1 != minWeight){
	    		minWeight='';
				$("#minWeight").val('');
			}
			if(maxWeight*1 != maxWeight){
				maxWeight='';
				$("#maxWeight").val('');
			}
	     	var resourceIds = $(obj).find(".resourceIds").val();
	     	resourceIds = !resourceIds ? "":resourceIds;
	    	var datas = {
	    			"resource.supID":$(obj).find(".supID").val(),
	    			"resource.supName":$(obj).find(".supName").val(),
	    			"resource.resource_Address":$(obj).find(".resource_Address").val(),
	    			"resource.resource_Name":$(obj).find(".resource_Name").val(),
	    			"resource.resource_Spec":$(obj).find(".resource_Spec").val(),
	    			"resource.resource_stuff":$(obj).find(".resource_stuff").val(),
	    			"resource.resource_Area":$(obj).find(".resource_Area").val(),
	    			"resource.supPickDate":$(obj).find(".supPickDate").val(),
	    			"resource.measureName":$(obj).find(".measureName").val(),
	    			"resource.resource_Price":$(obj).find(".resource_Price").val(),
	        		"resource.createUserID":$(obj).find(".createUserID").val(),
	        		"resource.createUser":$(obj).find(".createUser").val(),
	        		"resource.isProcImage":$(obj).find(".isProcImage").val(),
	        		"resource.name":$(obj).find(".stesort").val(),
	        		"resource.qualityObjection":$(obj).find(".qualityObjection").val(),
	     		    "resource.minWeight":minWeight,
	     		    "resource.maxWeight":maxWeight, 
	     		    "resource.saasUserID":$(obj).attr("saasUserID"), 
	     		    "resource.resource_storage":$(obj).find(".resource_storage").val()
	        		//"resource.searchCode":encodeURI($("#searchCodeTemp").val()),
	        		//"resource.searchCodeIndex":encodeURI(searchCodeTemp2),
	    			
	    			//"resource.resourceIds":resourceIds
	        };
	    	if(pageObj){
	    		for(var i in pageObj){
	    			datas[i]=pageObj[i];
	    		}
	    	}
	    	
	    	return datas;
		},
	    addCart:function (obj,resourceid,isProcImage){

		    //首先判断购买的资源是否是自己的资源
            var custMapCorpID = $("#custMapCorpID").val();
            var resourceSupID = $(obj).attr("supID");
            if(custMapCorpID!=null && custMapCorpID!="" && resourceSupID!=null && resourceSupID!="" ){
                if(custMapCorpID==resourceSupID){
                    alert("不能购买自己上挂的资源");
                    return;
                }
            }
	    	
	    	//判断是否已购买此资源
			if($(obj).attr("saasuserid")!="0A"){
				mallIndexUtil.toSaasMall($(obj).attr("saasuserid"),resourceid);
				return;
			}
	    	if($(obj).attr("disable")=="1"){
				return;
			}
	    	//判断是否已购买此资源
			if($(obj).attr("isHaveInCart")=="1"){
				alert('已经加入购物车');
				return;
			}
			$(obj).attr("disable",'1');

			//判断一下资源的类型是否金色还是绿色
			if(isProcImage=="0"){
				//判断资源的定价参数中的锁定计划量是否为0
				/*var lockPlanWeight = $(obj).attr("lockPlanWeight");
				var isLockPlan = $(obj).attr("isLockPlan");
				if(isLockPlan=="1"){
					alert("资源目前正更新维护中，请选择其他资源进行购买。");
					return;
				}*/

			}
			$.post(app.root+"/shopping/cart/addCartByResourceID.html",
	    			{"resourceID":resourceid,
	    			flag:1},function(data){
	    				var msg = data.message;
	    				if(msg == "no_login"){
	    					if(confirm("您还没有登录，请您先登录！")){
	    						location.href = app.root + "/login/toComLogin.html?returnUrl="+app.root+url;
	    					}
	    				}
	    				if(msg == "ok"){
	    					$(obj).addClass("active");
	    					$(obj).attr("isHaveInCart","1");
	    					addCartSuccess(obj,isProcImage);
	    				}else if(msg == "erorr"){
    						alert("加入购物车失！");
    					}else if(msg == "erorr_1"){
    						alert("购物车中已有金色资源，非金色资源不能加入到购物车");
    					}else if(msg == "erorr_2"){
    						alert("您所购买的资源已售罄,请选择其他资源");
    					}else if(msg == "erorr_3"){
    						alert("资源更新维护中，请选择其他资源购买");
    					}else if(msg == "erorr_4"){
    						alert("您所购买的资源已售罄,请选择其他资源");
    					}else if(msg == "erorr_5"){
    						alert("您所购买的资源重量不合法,请核实后购买");
    					}
	    				$(obj).attr("disable",'0');
	    			},'json');
	    },
	    toSaasMall:function (saasUserID,resourceid){
	    	var str = "";
	    	if(resourceid){
	    		str =  "?srid="+resourceid;
	    	}
	    	$.post(app.root+"/login/loadSaasUserAddr",
	    			{"saasUserID":saasUserID},
	    			function(data){
	    				if(data&&data.shopURL){
	    					location.href=data.shopURL+"/mall/index"+str;
	    				}else{
	    					alert("您所购买的资源已售罄,请选择其他资源");
	    				}
	    			});
	    }

};
